package com.pilot.game.service;

import com.pilot.game.domain.Kind;
import com.pilot.game.repository.KindRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * Service Implementation for managing Kind.
 */
@Service
@Transactional
public class KindService {

    private final Logger log = LoggerFactory.getLogger(KindService.class);

    private final KindRepository kindRepository;

    public KindService(KindRepository kindRepository) {
        this.kindRepository = kindRepository;
    }

    /**
     * Save a kind.
     *
     * @param kind the entity to save
     * @return the persisted entity
     */
    public Kind save(Kind kind) {
        log.debug("Request to save Kind : {}", kind);
        return kindRepository.save(kind);
    }

    /**
     *  Get all the kinds.
     *
     *  @param pageable the pagination information
     *  @return the list of entities
     */
    @Transactional(readOnly = true)
    public Page<Kind> findAll(Pageable pageable) {
        log.debug("Request to get all Kinds");
        return kindRepository.findAll(pageable);
    }

    /**
     *  Get one kind by id.
     *
     *  @param id the id of the entity
     *  @return the entity
     */
    @Transactional(readOnly = true)
    public Kind findOne(Long id) {
        log.debug("Request to get Kind : {}", id);
        return kindRepository.findOne(id);
    }

    /**
     *  Delete the  kind by id.
     *
     *  @param id the id of the entity
     */
    public void delete(Long id) {
        log.debug("Request to delete Kind : {}", id);
        kindRepository.delete(id);
    }
}
